package com.hrt.datasender.datacollect.serial.protocol;

import com.btcode.reflect.IClassFinder;

/**
 * 驱动类查找器
 * 
 * @author gislin
 *
 */
public class SerialDataProtocolFinder implements IClassFinder {

    @Override
    public boolean isMatch(Class<?> myClass) {

        Object instance;

        try {
            instance = myClass.newInstance();
        }
        catch (InstantiationException | IllegalAccessException e) {
            return false;
        }

        /**
         * 必须要继承ISerialDataProtocol
         */
        if (instance instanceof ISerialDataProtocol) {
            return true;
        }

        return false;
    }

}
